<template>
	<view class="content">
		<view class="header">
			<u-search placeholder="输入要认领的达人昵称/ID" v-model="value"  :show-action="false" @search="getList"></u-search>
			<text style="margin-left: 12rpx;" @click="cancal">取消</text>
		</view>
		<view class="list" >
			<view class="item" v-for="(item,index) in influencersList" :key="index">
				<view class="itemContent">
					<view class="title">
						<view class="name u-flex">
							<view class="avatar ">
								<image :src="item.user.avatar" mode=""></image>
							</view>
							{{item.user.nickname || ''}}
							<view class="lableBoxS" style="margin-left: 8rpx;">
								<view v-for="(i,inx) in item.user.identity_data" :key="inx" style="background-color: #DDE3F9;">
									{{i}}
								</view>
							</view>
						</view>
					<image v-if="!item.flag" class="radioImg" src="../../static/img/radio.png" mode="" @tap="check(item)">
					</image>
					<image v-else class="radioImg" src="../../static/img/radio1.png" mode="" @tap="check(item)"></image>
					</view>
					<view class="bottomBox">
						<!-- <view class="avatar"> -->
							<!-- <image src="../../static/img/Slice 40.png" mode=""></image> -->
						<!-- </view> -->
						<view class="userId">
							性别:<span style="margin: 0 8rpx;">{{item.user.gender? item.user.gender == 1? '男': item.user.gender == 2 ? '女' :'' : '未知'}}</span>
							<image class="genderImg" src="../../static/img/man.png" mode="" v-if="item.user.gender == 1"></image>
							<image class="genderImg" src="../../static/img/women.png" mode="" v-if="item.user.gender == 2"></image>
						</view>
						<view class="userId" style="margin-top: 16rpx;">
							用户ID:{{item.user.uid}}
						</view>
						<view class="">
			
						</view>
					</view>
					
					
				</view>
			</view>
		</view>
		


		
		<view class="u-flex bottom">
			<view class="padding-sm" style="width: 100%;">
				<u-button color="#7D81A9" shape="circle" text="取消认领" @click="submitAdopt"></u-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {

		data() {
			return {
				customStyle: {
					color: '#999999'
				},
				value: '',
				isCheck: false,
				influencersList: []
			};
		},
		created() {},
    onShow() {
      this.getList()
    },
		methods: {
			
			adopt() {
				this.isShow = false
				this.getinfluencersList()
			},
			async getinfluencersList() {
				const {
				  data: res
				} = await uni.$http.post('anchor/get_anchor_list')
								   
				console.log(res);
				let data = res.data || {}
				this.influencersList = data
				this.influencersList.forEach(item => {
					item.flag = false
				})
			},
			async submitAdopt() {
				let arr = this.influencersList.filter(item => item.flag == true).map(item => item.id)
				let obj = {
					ids: arr.toString()
				}
				const {
				  data: res
				} = await uni.$http.post('others/cancel_receive',obj)
								   
				if(res.code != 1) {
					this.toast.msg(res.msg)
					return
				}
				uni.showToast({
					icon:'success',
					title: res.msg
				})
				uni.navigateTo({
					url: '/pages/my/my-drmp'
				})
				
			},
			isCheckChange(item) {
				item.isCheck = !item.isCheck
				console.log(item.isCheck);
			},
			cancal() {
				this.value = ''
				this.getinfluencersList()
			},
			async getList() {
				let obj = {
					search_data:this.value
				}
				const {
				  data: res
				} = await uni.$http.post('others/get_receive_list',obj)
        if (res.code != 1) {
          this.toast.msg(res.msg)
          return
        }
        res.data.forEach((item) => {
          item.flag = false
        })
        this.influencersList = res.data
			
			},
      check(item) {
        this.influencersList.forEach((i) => {
          if (item.id == i.id) {
            item.flag = !item.flag
          }
        })
        console.log(this.influencersList);
      }
		},
		 onLoad() {
			
		}
	}
</script>

<style lang="scss">
  .avatar {
  	width: 36rpx;
  	height: 36rpx;
  	border-radius: 18rpx;
  	image {
  		width: 100%;
  		height: 100%;
  	}
  }
	.shaixuan-title {
		width: 160rpx;
		height: 44rpx;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #000000;
		line-height: 38rpx;
		margin-left: 30rpx;
		margin-top: 46rpx;

	}

	.grid-text {
		width: 156rpx;
		height: 64rpx;
		background: #F2F3F6;
		border-radius: 200rpx 200rpx 200rpx 200rpx;
		opacity: 1;
		font-size: 28rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #000000;
		line-height: 64rpx;
		text-align: center;
		margin-top: 42rpx;

	}

	.content {
		min-height: 100vh;
		background-color: #F2F3F6;

		.tabbar {
			position: fixed;
			left: 0;
			bottom: 0;
			z-index: 99;
		}

		.headerBox {
			box-sizing: border-box;
			padding-top: 108rpx;
			width: 100%;
			height: 278rpx;
			background: linear-gradient(200deg, #C6CBE1 0%, #FFFFFF 100%);
			border-radius: 0rpx 0rpx 0rpx 0rpx;
			opacity: 1;

			.title {
				text-align: center;
				font-size: 34rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #000000;
			}

			.screenBox {
				position: relative;
				box-sizing: border-box;
				padding: 0 28rpx 0 56rpx;
				margin-top: 40rpx;
				height: 60rpx;
				display: flex;
				align-items: center;
				font-size: 24rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #000000;

				.arrow-down {
					margin-left: 8rpx;
					width: 16rpx;
					height: 16rpx;
				}

				.city {
					margin-right: 56rpx;
				}

				.ipt {
					position: absolute;
					right: 28rpx;
					top: 0;
					box-sizing: border-box;
					width: 338rpx;
					height: 60rpx;
					line-height: 60rpx;
					background: #F2F3F6;
					border-radius: 124rpx 124rpx 124rpx 124rpx;
					padding: 0 24rpx 0 32rpx;

					// view {
					//  height: 60rpx;
					//  line-height: 60rpx;
					//   color: rgba(0,0,0,0.4);
					// }
					input {
						height: 60rpx;
						line-height: 60rpx;
						padding-right: 80rpx;
						box-sizing: border-box;
					}

					image {
						position: absolute;
						top: 10rpx;
						right: 24rpx;
						width: 40rpx;
						height: 40rpx;
					}
				}
			}
		}

		.list {
			padding-top: 24rpx;
			.item {
				width: 686rpx;
        height: 208rpx;
				padding-bottom: 26rpx;
				background: #FFFFFF;
				border-radius: 16rpx 16rpx 16rpx 16rpx;
				margin: 24rpx auto;

				.stateImg {
					width: 92rpx;
					height: 36rpx;
				}


				.itemContent {
					padding: 18rpx 22rpx 0 24rpx;

					.title {
						display: flex;
						align-items: center;

						.name {
							flex: 1;
							width: 380rpx;
							font-size: 24rpx;
							font-family: PingFang SC-Medium, PingFang SC;
							font-weight: 500;
							color: #000000;
							white-space: nowrap;
							overflow: hidden;
							text-overflow: ellipsis;

							.avatar {
                width: 36rpx;
                height: 36rpx;
                border-radius: 18rpx;
                overflow: hidden;
                margin-right: 8rpx;
                image {
                  width: 100%;
                  height: 100%;
                }
              }
						}

						.btns {

							display: flex;
							font-size: 24rpx;
							font-family: PingFang SC-Medium, PingFang SC;
							font-weight: 500;
							color: #FFFFFF;

							.btn {
								width: 128rpx;
								height: 52rpx;
								line-height: 52rpx;
								text-align: center;
								background: #7D81A9;
								border-radius: 40rpx;
								margin-right: 16rpx;
							}

							.frame {
								width: 52rpx;
								height: 52rpx;

								image {
									width: 52rpx;
									height: 52rpx;
								}
							}
						}
					}

					.lableBoxS {
						display: flex;
						color: rgba(0, 0, 0, 0.6);
						font-size: 20rpx;
						margin-top: 20rpx;
						margin-bottom: 18rpx;

						view {
							height: 32rpx;
							line-height: 32rpx;
							padding: 0 12rpx;
							margin-right: 8rpx;
						}
					}

					.numbers {
						display: flex;
						align-items: center;
						flex-wrap: wrap;

						.numberBox {
							width: 33%;
							display: flex;
							align-items: center;
							text-align: center;
						}

						.lable {
							font-size: 24rpx;
							color: #6E7480;
						}

						.num {
							font-size: 32rpx;
							color: #000000;
						}

						.golden {
							font-size: 32rpx;
							color: #EAA04A;
						}
					}

					.bottomBox {
						// display: flex;
						// align-items: center;
						height: 52rpx;
						margin-top: 14rpx;

					

						.userId {
							font-size: 24rpx;
							font-family: PingFang SC-Regular, PingFang SC;
							color: #6E7480;
							// margin: 0 8rpx;

							.copyImg {
								width: 28rpx;
								height: 28rpx;
								margin-left: 8rpx;
							}
						}

						.btnS {
							display: flex;

							.btn {
								width: 128rpx;
								height: 52rpx;
								line-height: 52rpx;
								text-align: center;
								background: #7D81A9;
								border-radius: 40rpx;
								font-size: 24rpx;
								font-family: PingFang SC-Medium, PingFang SC;
								font-weight: 500;
								color: #FFFFFF;
								margin-right: 16rpx;
							}

							.shareImg {
								width: 52rpx;
								height: 52rpx;
							}
						}
					}
				}
			}
		}
	.bottom {
		position: fixed;
		bottom: 0;
		height: 176rpx;
		width: 100%;
		border-radius: 28rpx 28rpx 0rpx 0rpx;
		background-color: #fff;
		
	}
	.header_box {
		display: flex;
		justify-content: space-between;
	}
	.header {
		height: 100rpx;
		display: flex;
		align-items: center;
		background-color: #fff;
		padding: 0 24rpx;
	}

	}
  .genderImg {
    width: 24rpx;
    height: 24rpx;
  }
.radioImg {
  width: 36rpx;
  height: 36rpx;
}
</style>